package com.jin.ks;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by lenovo on 2018/10/14.
 */

public class DatabaseUtil extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "user.db";  //数据库名
    private static final int DATABASE_VERSION = 1;               //数据库版本号

    public DatabaseUtil(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    /**
     * 创建数据库
     */
    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        createTable(sqLiteDatabase);
    }

    /**
     * 建立数据表
     */
    private void createTable(SQLiteDatabase db) {
        db.execSQL("create table UserInfo(" +
                "id integer primary key autoincrement," +
                "mStatus nchar(10)," +
                "mName nchar(20)," +
                "mKuaiId nchar(20)," +
                "mFan nchar(10)," +
                "mFollow nchar(10)," +
                "mMoment nchar(10)," +
                "mLike nchar(10)," +
                "mPhoto nchar(10)," +
                "mText nchar(20)," +
                "mBirthday nchar(10)," +
                "mTodayFollow nchar(10)," +
                "mTime nchar(10))");
    }

    /**
     * 升级数据库
     */
    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
